<!--
 * @Author: ZCL
 * @Date: 2020-05-19 13:59:47
 * @LastEditors: ZCL
 * @LastEditTime: 2020-05-19 13:59:47
-->
<template>
  <!-- 库存预警 - 领用记录 -->
  <div class="stockRecord">
    <div>
      <van-steps
        active-color="#38f"
        direction="vertical"
        active-icon="clock-o"
        inactive-icon="clock-o"
      >
        <van-step v-for="(item,index) in receiceRecordList" :key="index">
          <div class="time">{{ item.create_time }}</div>
          <div class="time-box">
            <div>
              <div class="box">
                <p class="time-left">领用部门:</p>
                <p class="time-right">{{ item.dept_name }}</p>
              </div>
              <div class="box">
                <p class="time-left">领用人员:</p>
                <p class="time-right">{{ item.user_name }}</p>
              </div>
              <div class="box">
                <p class="time-left">领用数量:</p>
                <p class="time-right">{{ item.re_status }}</p>
              </div>
              <div class="box">
                <p class="time-left">领用原因:</p>
                <p class="van-multi-ellipsis--l3 time-right">{{ item.re_reason }}</p>
              </div>
            </div>
          </div>
        </van-step>
      </van-steps>
    </div>

    <!-- 无数据 start -->
    <div class="" v-if="!receiceRecordList.length">
      <van-empty
        class="custom-image"
        :image="require('@/assets/icon/empty.png')"
        description="暂无数据~"
      />
    </div>
    <!-- 无数据 end -->

  </div>
</template>

<script>

export default {
  name: 'stockRecord',
  data () {
    return {
      receiceRecordList: [] // 耗材预警列表
    };
  },
  methods: {
    // 获取领用记录
    getRecord () {
      let params = {
        id: this.$route.query.id,
        type: 2
      };
      this.$api.getReceiceInfoRecord(params).then(res => {
        if (res.code === 0) {
          this.receiceRecordList = res.result;
        }
      });
    }
  },
  created () {
    this.getRecord(); // 获取领用记录
  }
};
</script>

<style lang="scss" scoped>
.stockRecord {
  padding-bottom: 40px;
  background-color: #f8f9fd;
  ::v-deep.van-steps {
    background-color: #f8f9fd;
  }
  ::v-deep.van-step--vertical {
    padding-bottom: 0;
  }
  ::v-deep.van-icon {
    color: #0A8EFF !important;
    font-size: 16px;
  }
  ::v-deep.van-step__line {
    width: 1px;
  }
  .time {
    font-size: 12px;
    color: #717171;
  }
  .time-box {
    font-size: 13px;
    margin: 5px 10px 0 5px;
    padding: 12px;
    border-radius: 3px;
    background-color: #fff;
    box-shadow: 0px 0px 9px 2px rgba(221, 221, 221, 0.31);
    .box {
      display: flex;
      justify-content: flex-start;
      padding-bottom: 8px;
      .time-left {
        width: 60px;
        color: #AAAAAA;
      }
      .time-right {
        color: #2A2A2A;
        width: 232px;
      }
    }
    ::v-deep.van-multi-ellipsis--l3{
      width: 232px;
    }
  }
}
</style>
